home *** CD-ROM | disk | FTP | other *** search
- /* This is file DOSLOCK.S */
- /*
- ** Public domain, written by Pasi Eronen (pasi@forum.nullnet.fi).
- **
- ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
- ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- */
-
- .text
- .globl __dos_lock
- .globl __dos_unlock
- __dos_lock:
- /* int fd, long offset, long length */
- pushl %ebx
- pushl %esi
- pushl %edi
-
- movl 16(%esp),%ebx
- movl 20(%esp),%ecx
- shrl $16,%ecx
- movl 20(%esp),%edx
- andl $0xffff,%edx
- movl 24(%esp),%esi
- shrl $16,%esi
- movl 24(%esp),%edi
- andl $0xffff,%edi
-
- movw $0x5c00,%ax
- int $0x21
- popl %edi
- popl %esi
- popl %ebx
-
- jb error_found
- mov $0,%eax
- error_found:
- andl $0xffff,%eax
- ret
-
- __dos_unlock:
- /* int fd, long offset, long length */
- pushl %ebx
- pushl %esi
- pushl %edi
-
- movl 16(%esp),%ebx
- movl 20(%esp),%ecx
- shrl $16,%ecx
- movl 20(%esp),%edx
- andl $0xffff,%edx
- movl 24(%esp),%esi
- shrl $16,%esi
- movl 24(%esp),%edi
- andl $0xffff,%edi
-
- movw $0x5c01,%ax
- int $0x21
- popl %edi
- popl %esi
- popl %ebx
-
- jb error_found2
- mov $0,%eax
- error_found2:
- andl $0xffff,%eax
- ret
-
-